package com.miukoo.aikao.core.dtos;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

/**
　* @Author miukoo<miukoo@126.com>
　* @Date 2020/11/19 19:26
　* @Version 1.0
  */
@ApiModel(value="分页响应参数", description="分页响应参数")
@Setter
@Getter
public class PageResDto<T> {


    @ApiModelProperty(value = "总条数", required = true, example = "1")
    private Long total;

    @ApiModelProperty(value = "分页数据")
    private T data;

    public PageResDto(Long total,T data){
        this.total = total;
        this.data = data;
    }

    /**
     * 快速返回实例
     * @param total 总页数
     * @param data  数据
     * @param <T>   数据类型
     * @return
     */
    public static<T> PageResDto<T> result(Long total,T data){
        return new PageResDto(total,data);
    }

}
